// 
// Bachelor of Software Engineering
// Media Design School
// Auckland
// New Zealand
//
// (c) 2005 - 2014 Media Design School
//
// File Name	: SolitaireLogic.h
// Desrciption	: CSolitaireLogic declaration file.
// Author(s)	: Hayden Asplet.
// Mail			: hayden.asplet@mediadesignschool.com
//

#pragma once

#ifndef __SOLITAIRELOGIC_H__
#define __SOLITAIRELOGIC_H__

// Library Includes

// Local Includes
#include "CardStack\CardStack.h"
#include "CardStack\BuildStack.h"
#include "CardStack\WinStack.h"
#include "CardStack\ShowStack.h"
#include "CardStack\LerpStack.h"

class CSolitaireLogic : public CGameLogic {
	// Member Functions
public:
	CSolitaireLogic();

	virtual ~CSolitaireLogic();

	virtual bool VInit();
	virtual void VUpdate(float _fDeltaTime);

	virtual bool VStartDrag(const CPoint& _krDragStartPosition);
	virtual void VReleaseDrag();

	virtual void VOnLMBPressed();
	virtual void VOnRMBPressed();
	virtual void VOnLMBReleased();
	virtual void VOnRMBReleased();
	virtual void VOnLDoubleClick();

	void SetCardDrawAmount(int _iCardDrawAmount);

	void DrawCard(const CPlayingCard& _krCard);
	void DrawStack(const CCardStack& _krStack);

	void SetupGame();
protected:

private:
	void DebugCard(const CPlayingCard& _krCard);	// Displays all the details of the passed in card to the console.

	// Member Variables
public:
protected:
private:
	// Sprites
	CSprite m_background;
	CSprite m_cardSprites;		// The main sprite sheet; Contains all 52 cards.
	CSprite m_cardBackSprite;

	// Card Stacks.
	std::vector<CBuildStack> m_buildStacks;	// The 7 stacks the user builds ontop of.
	std::vector<CWinStack> m_winStacks;		// The 4 stacks that the user completes to win.
	CShowStack m_deckStack;					// The deck.
	CShowStack m_wasteStack;				// The drawn/flipped or discarded pile.
	CCardStack m_draggingStack;				// The stack the user is dragging.

	CPoint m_dragOffset;				// The offset at which the card/stack is moved.
	CCardStack* m_pDraggedFromStack;	// A pointer to the stack we are dragging from.
										// Used when sending the dragging stack back.

	std::list<CLerpStack> m_lerpingStacks;	// The cards that are currently lerping. Stored in a list so that,
											// we can pop_front() aswell as iterate through.
	bool m_bHasWon;

	int m_iScore;					// The players score.
	int m_iCardDrawAmount;			// The amount of card draw this game.
	int m_iCardDrawQueuedAmount;	// The amount of card draw for next game.	
};


#endif